Object

Random Class

Use to generate random numbers.

Properties

Seed

Methods

Gaussian

InRange

LessThan

Number

Notes


The Random class supersedes the Rnd function. It performs the same functions and more.

You should create only one Random object per application. Creating an new Random object each time you need another random number is inefficient and can lead to some hard-to-find bugs.


Example

The following example generates a random integer in the range from 0 to 1,000.

Dim r as New Random
Statictext1.Text= Str(r.InRange(0,1000))

See Also

Rnd function.